package deng.hibernate.test.blob;

import java.sql.Blob;

/**
 * If you are using MySQL, ensure max_allowed_packet is the right size.
 * 
 * SET GLOBAL max_allowed_packet=16*1024*1024;
 * 
 * http://dev.mysql.com/doc/refman/5.0/en/blob.html
 * http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html
 * 
 */
public class Image {

	private long id;
	
	private String name;
		
	private Blob blobData;
	
	private byte[] bytesData;
		
	@Override
	public String toString() {
		return "Image[id=" + id + ",name=" + name + ", blobData=" + blobData + ", bytesData.len=" + (bytesData == null ? "<null>" : bytesData.length) + "]";
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Blob getBlobData() {
		return blobData;
	}

	public void setBlobData(Blob blobData) {
		this.blobData = blobData;
	}

	public byte[] getBytesData() {
		return bytesData;
	}

	public void setBytesData(byte[] bytesData) {
		this.bytesData = bytesData;
	}
	
}
